package Enums;

public enum DocType {
    SOP(0),
    FORM(1),
    MISC(2),
    SALES_SHEET(3),
    PRODUCT_INFO(4),
    LAB_SOP(5);
    
    private int type;

    DocType(final int type) {
        this.type = type;
    }

    public int getType() {
        return type;
    }
    
    public static DocType getType(final String type) {
            return getType(Integer.parseInt(type));
    }
    
    public static DocType getType(final int type) {
        switch (type) {
        case 0:
            return SOP;
        case 1:
            return FORM;
        case 2:
            return MISC;
        case 3:
            return SALES_SHEET;
        case 4:
            return PRODUCT_INFO;
        case 5:
            return LAB_SOP;
        default:
            throw new EnumConstantNotPresentException(DocType.class, String.valueOf(type));
        }
    }
    
    
    public static int getTypeByName(final String str) {
        if(str.equals("SOP")){
            return 0;
        } else if(str.equals("FORM")){
            return 1;
        } else if(str.equals("MISC")){
            return 2;
        } else if(str.equals("SALES_SHEET")){
            return 3;
        } else if(str.equals("PRODUCT_INFO")){
            return 4;
        } else if(str.equals("LAB_SOP")){
            return 5;
        } else {
            return 0;
        }
    }
    
    public static String getTypeDescription(final int task) {
        switch (task) {
            case 0:
                return "Standard Operating Procedure: ";
            case 1:
                return "Form: ";
            case 2:
                return "Misc. Documentation: ";
            case 3:
                return "Sales Sheet: ";
            case 4:
                return "Product Info: ";
            case 5:
                return "Lab Operating Procedure: ";
            default:
                throw new EnumConstantNotPresentException(DocType.class, String.valueOf(task));
        }
    }
}
